package cn.yusei.teamTribe.service.post;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yusei.teamTribe.dao.post.PostReflecDAO;

@Service
public class PostReflectService {

	@Autowired
	private PostReflecDAO postReflecDAO;
	
	/**
	 * 获取 postId 属于的 User ，如果不存在，返回0
	 * @param postId
	 * @return
	 */
	public int getUserId(int postId)
	{
		Integer id = null;
		id = postReflecDAO.selectUserById(postId);
		return id == null ? 0 : id;
	}
	
	/**
	 * 获取 postId 属于的Team，如果不存在，返回0
	 * @param postId
	 * @return
	 */
	public int getTeamId(int postId)
	{
		Integer id = null;
		id = postReflecDAO.selectTeamById(postId);
		return id == null ? 0 : id;
	}
	
}
